package com.bot.nft.module.dc.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bot.auth.core.pojo.SaBaseClientLoginUser;
import com.bot.auth.core.util.StpClientLoginUserUtil;
import com.bot.common.pojo.CommonResult;
import com.bot.nft.module.dc.controller.DcOrderInfoController;
import com.bot.nft.module.dc.domain.bo.DcOrderQueryListBo;
import com.bot.nft.module.dc.domain.vo.DcOrderVo;
import com.bot.nft.module.dc.service.IDcOrderInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.bot.common.util.CommonCryptogramUtil.doSm4CbcEncrypt;

/**
 * 描述: 藏品订单
 * 时间: 2023-12-04 10:37
 * 负责人: 任晓政
 **/
@RestController
@RequestMapping("/app/nft")
@CrossOrigin
public class AppDcOrderController extends DcOrderInfoController {

    @Resource
    IDcOrderInfoService dcOrderService;

    //分页查询藏品订单信息
    @RequestMapping("/{pageNo}/{pageSize}/queryOrders.do")
    public CommonResult<Page<DcOrderVo>> queryOrders(@RequestBody DcOrderQueryListBo dcOrderQueryListBo, @PathVariable("pageNo") Integer pageNo, @PathVariable("pageSize") Integer pageSize) {
        SaBaseClientLoginUser clientLoginUser = StpClientLoginUserUtil.getClientLoginUser();
        String phone = doSm4CbcEncrypt(clientLoginUser.getPhone());
        dcOrderQueryListBo.setPhone(phone);
        Page<DcOrderVo> dcOrderVoPage = dcOrderService.queryOrder(dcOrderQueryListBo, pageNo, pageSize);
        return CommonResult.data(dcOrderVoPage);
    }


}
